Fix/arbitrary failing on feature flag#1128
Conversation
This commit adds conditional attribute, which implements the `Arbitrary` trait when compiled with `--features arbitrary`; this is to ensure, sucessful checks/builds for future fuzzing implementation
|
Benoît Cortier (@CBenoit) |
Added conditional arbitrary for structs/enums that support it; files related to this commit most probably won't require manual impl of the Arbitrary trait. Due to inter-dependency, most of the struct/enums had to be configured
…uence The mannual impl for ChannelName follows the 8-bi null-terminated sequence; and the mannual impl for LicenseExchangeSequence generates arbitrary for all attributes except the license_cache
#cfg_attr for ChunkProcessor,StaticVirtualChannel and a constructor for the StaticChannelSet(as it has TypeId which is populated by the compiler)
|
I was not confident with some of the impls so I've added Mannual impls are done for:
|
|
The checks are passing for as of now: cargo check -p ironrdp-connector --features arbitrary
cargo check -p ironrdp-pdu --features arbitrary |
| pub domain: Option<String>, | ||
| pub hardware_id: [u32; 4], | ||
| pub license_cache: Arc<dyn LicenseCache>, | ||
| pub _phantom: std::marker::PhantomData<u8>, |
There was a problem hiding this comment.
question: Why did you add this PhantomData?
There was a problem hiding this comment.
I initially thought it was required for the dyn trait object to compile successfully, so I left it in there and forgot about it, even after the manual impl for LicenseExchangeSequence.
It compiles fine without it and isn't needed, my bad:))
| // MIGHT NEED CHANGE, currently it's not using arbitrary function | ||
| license_cache: Arc::new(NoopLicenseCache), |
There was a problem hiding this comment.
I think this is perfectly fine as we don’t provide any LicenseCache implementation as part of this crate. Implementers wishing to fuzz using their license cache should do so on their side.
Benoît Cortier (CBenoit)
left a comment
There was a problem hiding this comment.
I’m not entirely sure what the Arbitrary trait is meant to do in ironrdp-svc: we’re probably not going to deal with "arbitrary static virtual channels", so maybe a better way would be to manually implement the trait at some places more in ironrdp-connector 🤔
|
I understand, the structs in the ironrdp-svc crate were used in some other places which had to implement arbitrary, so without those checks wouldn't compile. |
|
Thanks for taking this on. The I have been reading through the diff in preparation for picking up some of the structured-fuzzing follow-on work, and I wanted to consolidate the open items in one place so this PR has a clear path to land. Outstanding technical items
CoordinationIf you are still actively working on this and just bandwidth-limited, that is fine on my side. If you would welcome a collaborator on the architectural reshape in item 1 and the rebase in item 7 while you stay as the main author, I can chip in there. Either way works for me. The structured-fuzzing infrastructure work in #1122 and #1124 is downstream of this PR landing. Let me know what would be most useful. |
|
I went ahead and filed #1272 to address #1121 directly. The downstream fuzzing work in #1122 through #1124 was blocked on this landing, and the 2026-05-11 ping here did not get a response, so I treated the path as clear to step in. Your exploration in this PR was the starting point. The decisions in #1272 about the |
|
Closing this PR since #1272 was merged earlier today. Thank you for the initial exploration! |
working on #1121